const {getHttpSearch} = require("../../models/http")
Page({
  data:{
    arr:[],
    playState:{}
  },
  onLoad(){
  },
  handleSubmit(event){
    var {keyword} = event.detail.value
    getHttpSearch({
      keyword,
      success:res=>{
        var arr = res.data.result.albums
        this.setData({
          arr
        })
      }
    })
  },
  handlePlay(event){
    var id = event.currentTarget.dataset.id
    var playState = this.data.playState
    playState[id] = !playState[id]
    for(let key in playState){
      if(key!=id){
        playState[key] = false
      }
    }
    this.setData({
      playState
    })
  }
})
